package com.autumn.mybatis;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;

import com.autumn.mybatis.mapper.MapperRegister;

/**
 * Autumn 会话工厂 Bean
 * 
 * @author 老码农 2018-04-03 23:01:03
 */
public class AutumnSqlSessionFactoryBean extends SqlSessionFactoryBean {	

	private MapperRegister mapperRegister;

	public AutumnSqlSessionFactoryBean(MapperRegister mapperRegister) {
		this.mapperRegister = mapperRegister;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		super.afterPropertiesSet();
		SqlSessionFactory factory = this.getObject();
		this.mapperRegister.configure(factory.getConfiguration());
	}
}
